﻿using University.Workshop.DataAccess;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.Model;
using System.Collections.ObjectModel;
using System.Windows.Forms;

namespace University.Workshop.Tests
{


    /// <summary>
    ///This is a test class for RoomDataAccessTest and is intended
    ///to contain all RoomDataAccessTest Unit Tests
    ///</summary>
    [TestClass()]
    public class RoomDataAccessTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for GetAllRoomByIdType
        ///</summary>
        [TestMethod()]
        public void GetAllRoomByIdTypeTest()
        {
            RoomDataAccess target = new RoomDataAccess(); // TODO: Initialize to an appropriate value
            int idType = 0; // TODO: Initialize to an appropriate value
            Collection<Room> expected = new Collection<Room>(); // TODO: Initialize to an appropriate value
            Collection<Room> actual;
            actual = target.GetAllRoomByIdType(idType);
            Assert.IsNotNull(actual);

        }

        /// <summary>
        ///A test for ExistingRoom
        ///</summary>
        [TestMethod()]
        public void ExistingRoomTest()
        {
            RoomDataAccess target = new RoomDataAccess(); // TODO: Initialize to an appropriate value
            Room room = new Room("a20"); // TODO: Initialize to an appropriate value
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.ExistingRoom(room);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///A test for GetAllRooms
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void GetAllRoomsTest()
        {
            RoomDataAccess target = new RoomDataAccess(); // TODO: Initialize to an appropriate value
            target.Dispose();
            DataGridView rooms = new DataGridView(); // TODO: Initialize to an appropriate value
            target.GetAllRooms(rooms);

        }



        /// <summary>
        ///A test for GetByName
        ///</summary>
        [TestMethod()]
        public void GetByNameTest()
        {
            RoomDataAccess target = new RoomDataAccess(); // TODO: Initialize to an appropriate value
            string name = "a20"; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.GetByName(name);
            Assert.IsTrue(actual == 0);
        }

        /// <summary>
        ///A test for GetIdRoomByName
        ///</summary>
        [TestMethod()]
        public void GetIdRoomByNameTest()
        {
            RoomDataAccess target = new RoomDataAccess(); // TODO: Initialize to an appropriate value
            string name = "a21"; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.GetIdRoomByName(name);


        }

        /// <summary>
        ///A test for GetPriceByName
        ///</summary>
        [TestMethod()]
        public void GetPriceByNameTest()
        {
            RoomDataAccess target = new RoomDataAccess(); // TODO: Initialize to an appropriate value
            string name = "Simple"; // TODO: Initialize to an appropriate value
            Decimal actual;
            actual = target.GetPriceByName(name);
        }

        /// <summary>
        ///A test for GetTypeOfRoomByName
        ///</summary>
        [TestMethod()]
        public void GetTypeOfRoomByNameTest()
        {
            RoomDataAccess target = new RoomDataAccess(); // TODO: Initialize to an appropriate value
            string name = "Simple"; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.GetTypeOfRoomByName(name);
        }

        /// <summary>
        ///A test for NewRoom
        ///</summary>
        [TestMethod()]
        public void NewRoomTest()
        {
            Random ran = new Random(DateTime.Now.Millisecond);
            RoomDataAccess target = new RoomDataAccess(); // TODO: Initialize to an appropriate value
            Room room = new Room(ran.Next(1000), "A15", 15);
            target.NewRoom(room);

        }


        /// <summary>
        ///A test for GetRoomInCheckIn
        ///</summary>
        [TestMethod()]
        public void GetRoomInCheckInTest()
        {
            RoomDataAccess target = new RoomDataAccess(); // TODO: Initialize to an appropriate value
            ComboBox room = new ComboBox(); // TODO: Initialize to an appropriate value
            target.GetRoomInCheckIn(room);
        }

        /// <summary>
        ///A test for DeleteCheckIn
        ///</summary>
        [TestMethod()]
        public void DeleteCheckInTest()
        {
            RoomDataAccess target = new RoomDataAccess(); // TODO: Initialize to an appropriate value
            string idClient = "rj452"; // TODO: Initialize to an appropriate value
            target.DeleteCheckIn(idClient);
        }

        /// <summary>
        ///Una prueba de GetTakenRooms
        ///</summary>
        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void GetTakenRoomsTest()
        {
            RoomDataAccess target = new RoomDataAccess(); // TODO: Inicializar en un valor adecuado
            DateTime dateTime = new DateTime(); // TODO: Inicializar en un valor adecuado
            DataGridView rooms = null; // TODO: Inicializar en un valor adecuado
            target.GetTakenRooms(dateTime, rooms);
        }
    }
}
